package com.device.entity;

import javax.persistence.*;
import java.util.UUID;

@Entity
@Table(name = "user_credentials")
public class UserCredentials {
    
    @Id
    @Column(name = "id")
    private UUID id;
    
    @Column(name = "created_time", nullable = false)
    private Long createdTime;
    
    @Column(name = "activate_token", unique = true)
    private String activateToken;
    
    @Column(name = "activate_token_exp_time")
    private Long activateTokenExpTime;
    
    @Column(name = "enabled")
    private Boolean enabled;
    
    @Column(name = "password")
    private String password;
    
    @Column(name = "reset_token", unique = true)
    private String resetToken;
    
    @Column(name = "reset_token_exp_time")
    private Long resetTokenExpTime;
    
    @Column(name = "user_id", unique = true)
    private UUID userId;
    
    @Column(name = "additional_info")
    private String additionalInfo = "{}";
    
    @Column(name = "last_login_ts")
    private Long lastLoginTs;
    
    @Column(name = "failed_login_attempts")
    private Integer failedLoginAttempts;
    
    // Constructors
    public UserCredentials() {}
    
    public UserCredentials(UUID userId, String password) {
        this.id = UUID.randomUUID();
        this.userId = userId;
        this.password = password;
        this.createdTime = System.currentTimeMillis();
        this.enabled = true;
        this.failedLoginAttempts = 0;
    }
    
    // Getters and Setters
    public UUID getId() {
        return id;
    }
    
    public void setId(UUID id) {
        this.id = id;
    }
    
    public Long getCreatedTime() {
        return createdTime;
    }
    
    public void setCreatedTime(Long createdTime) {
        this.createdTime = createdTime;
    }
    
    public String getActivateToken() {
        return activateToken;
    }
    
    public void setActivateToken(String activateToken) {
        this.activateToken = activateToken;
    }
    
    public Long getActivateTokenExpTime() {
        return activateTokenExpTime;
    }
    
    public void setActivateTokenExpTime(Long activateTokenExpTime) {
        this.activateTokenExpTime = activateTokenExpTime;
    }
    
    public Boolean getEnabled() {
        return enabled;
    }
    
    public void setEnabled(Boolean enabled) {
        this.enabled = enabled;
    }
    
    public String getPassword() {
        return password;
    }
    
    public void setPassword(String password) {
        this.password = password;
    }
    
    public String getResetToken() {
        return resetToken;
    }
    
    public void setResetToken(String resetToken) {
        this.resetToken = resetToken;
    }
    
    public Long getResetTokenExpTime() {
        return resetTokenExpTime;
    }
    
    public void setResetTokenExpTime(Long resetTokenExpTime) {
        this.resetTokenExpTime = resetTokenExpTime;
    }
    
    public UUID getUserId() {
        return userId;
    }
    
    public void setUserId(UUID userId) {
        this.userId = userId;
    }
    
    public String getAdditionalInfo() {
        return additionalInfo;
    }
    
    public void setAdditionalInfo(String additionalInfo) {
        this.additionalInfo = additionalInfo;
    }
    
    public Long getLastLoginTs() {
        return lastLoginTs;
    }
    
    public void setLastLoginTs(Long lastLoginTs) {
        this.lastLoginTs = lastLoginTs;
    }
    
    public Integer getFailedLoginAttempts() {
        return failedLoginAttempts;
    }
    
    public void setFailedLoginAttempts(Integer failedLoginAttempts) {
        this.failedLoginAttempts = failedLoginAttempts;
    }
} 